<div class="col-md-8">
<div class="main-content" id="main-content">
	<div class="sub-content">
		<div class="top-header page-header clearfix">
			<h1>Acceptance for buy on product</h1>
		</div><br/>
	<div class="user-profile1 col-md-12">	
		<form id="confirmStatus" name="confirmStatus"  method="post" class="form-horizontal" role="form">
			
				<div class="form-group">
				<label class="control-label col-sm-3">Admin</label>
							<div class="select_6 col-sm-9">
								<select id="admindropdown" name="admindropdown" class="form-control">
									<option value="">Select The Admin</option>
								</select>
							</div>
				</div><span style="color:red" id="erroradmin"></span>			
				<div class="form-group">
								<label class="control-label col-sm-3">User</label>
								<div class="select_6 col-sm-9">
									<select id="userdropdown" name="userdropdown" class="form-control">
										<option value="">Select The User</option>
									</select>
								</div>	
				</div><span style="color:red" id="erroruser"></span>
				<div class="form-group">
					<label class="control-label col-sm-3">User Name</label>
					<div class="col-sm-9">
					<input type="hidden" id="uname" name="uname" value="<? if(isset($this->allbuyslist->company_name)){echo $this->allbuyslist->company_name;}?>"/>
					<input type="text" class="input_type_text" class="form-control" readonly="readyonly" value="<? if(isset($this->allbuyslist->company_name)){echo $this->allbuyslist->company_name;}?>"/></div>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-3">Product Name</label>
					<div class="col-sm-9">
					  <input type="hidden" id="pname" name="pname" value="<? if(isset($this->allbuyslist->genericname)){ echo $this->allbuyslist->genericname;}?>"/>
                       <input type="text" class="input_type_text" class="form-control" readonly="readonly" value="<? if(isset($this->allbuyslist->genericname)){ echo $this->allbuyslist->genericname;}?>"/></div>
				</div>
				<div class="form-group">
					<label class="control-label col-sm-3">Actual Price</label>
						<div class="col-sm-9">
						<input type="hidden" id="bprice" name="bprice" value="<? if(isset($this->allbuyslist->genericname)){ echo $this->allbuyslist->order_for_price;}?>" />
							<input type="text" class="input_type_text" class="form-control" readonly="readonly" value="<? if(isset($this->allbuyslist->genericname)){ echo $this->allbuyslist->order_for_price;}?>" />	</div>					
				</div>
				<div class="sub_off">
					<div class="form-group">
						<label class="control-label col-sm-3">Confirm Status</label>
						<div class="select_6 col-sm-9">
							<select id="status" name="status" class="form-control">
								<option value="" >Select</option>
								<option value="pending" >Pending</option>
								<option value="accepted" >Accepted</option>
							</select>
						</div>
					</div>
				</div>
				<div class="form-group">
					<div class="botton_btns">
						<div class="col-sm-3">&nbsp;</div>
						<div class="col-sm-9">
						   <a href="javascript:void();" class="btn btn-danger" onclick="return acceptanceOnproduct();" role="button">Submit</button>
						   <a class="back_btn btn btn-danger" href="<? echo $this->Url('products')?>/view-buy-detailes?product=<? echo $_GET['product'];?>" role="button">Back</a>
						   <div id="loading" style="display:none;float:right;margin-right:30px;"><img src="<?php echo $this->basePath() ?>/images/loading_image.gif" /></div></div>
						</ul>
					</div>
				</div>
				<input type="hidden" id="hid_buy_id" name="hid_buy_id" value="<? if(isset($this->allbuyslist->buy_id)){ echo $this->allbuyslist->buy_id;}?>">
				<input type="hidden" id="hid_product_id" name="hid_product_id" value="<? if(isset($_GET['product'])){ echo $_GET['product'];}?>">
			</form>
		</div>
	</div>
</div></div>
<script>
	function acceptanceOnproduct(){
		var admindrop=$("#admindropdown").val();
		var userdrop=$("#userdropdown").val();
		var confirm_status=$("#status").val();
		if(admindrop=="")
		{
			$('#erroradmin').html('*Select the admin');	
				return false;
		}else{
			$('#erroradmin').html('');
		}
		if(userdrop=="")
		{
			$('#erroruser').html('*Select the user');	
				return false;
		}else{
			$('#erroruser').html('');
		}
		
		if(confirm_status==''){
			alert('Please select confirmation');return false;
		}else{
		    $("#loading").show();
			$("#confirmStatus").submit();
		}
	}
	$(function() {
		  <?php if(isset($_GET['success'])&& $_GET['success']=='success'){?>
		      $("#loading").hide();
			  alert("Your Acceptance is successfully.");
			  window.location=BASE_URL+"/products/buy-received-products";
		  <?}?>
	 });
</script>









